package megatron.view.cadastros;

import java.net.URL;
import java.util.ResourceBundle;

import megatron.view.Main;

import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.SplitPane;
import javafx.scene.control.TitledPane;
import javafx.scene.control.TreeView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;

public class MdiCadastroController extends AnchorPane implements Initializable{

	@FXML
	private Menu mnModulo, mnCadastro;
	
	@FXML
	private MenuItem mniCad, mniGeComp,	mniGeFat, mniGeEsFis, mniGeCont, mniGePat, mniGePro, mniGeFin, mniGeCus;
	
	@FXML
	private MenuItem mniCadEmpresa;
	
	@FXML
	private SplitPane divisor;
	
	@FXML
	private Pane painel;

	@FXML
	public AnchorPane mainAppCad;
	
	@FXML
	private AnchorPane anPrincipal, anPrincipal2, anPrincipal3, anPrincipal4, anPrincipal5, anPri;
	
	@FXML
	private TitledPane acModulo, acCadastro;
	
	@FXML
	private TreeView<String> trModulo, trCadastro;
	
	@FXML
	private ScrollPane spCent;
	
	private static MdiCadastroController instance;
	
	private Main application;
	
	public MdiCadastroController() {
	    instance = this;
	}
	
	public static MdiCadastroController getInstance() {
	    return instance;
	}
	
	@Override
	public void initialize(URL location, ResourceBundle resources) {
		// TODO Auto-generated method stub
	}
	
	public void setApp(Main application){
        this.application = application;
    }
	
	public void MnICadAction(){
		application.getInstance().gotoModulo(mniCad.getText());
	}
	
	public void MnIGeCusAction(){
		application.getInstance().gotoModulo(mniGeCus.getText());
	}
	
	public void MnIGeFinAction(){
		application.getInstance().gotoModulo(mniGeFin.getText());
	}
	
	public void MnIGeProAction(){
		application.getInstance().gotoModulo(mniGePro.getText());
	}
	
	public void MnIGePatAction(){
		application.getInstance().gotoModulo(mniGePat.getText());
	}
	
	public void MnIGeContAction(){
		application.getInstance().gotoModulo(mniGeCont.getText());
	}
	
	public void MnIGeEsFisAction(){
		application.getInstance().gotoModulo(mniGeEsFis.getText());
	}
	
	public void MnIGeFatAction(){
		application.getInstance().gotoModulo(mniGeFat.getText());
	}
	
	public void MnIGeCompAction() throws Exception {
		application.getInstance().gotoModulo(mniGeComp.getText());
	}
	
	public void CadEmpresaAction(){
		application.getInstance().gotoCadastroEmpresa();
	}
}
